package com.suyin.ximoon.controller.system;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.suyin.ximoon.controller.base.BaseController;
import com.suyin.ximoon.model.LyUserlogin;
import com.suyin.ximoon.model.bo.Page;
import com.suyin.ximoon.service.LyUserloginService;
import com.suyin.ximoon.util.Common;
import com.suyin.ximoon.util.Tools;

/**
 * 
 * @author lanyuan 2014-11-19
 * @Email: mmm333zzz520@163.com
 * @version 3.0v
 */
@Controller
@RequestMapping("/userlogin/")
public class UserLoginController extends BaseController {
	@Inject
	private LyUserloginService userLoginService;

	@RequestMapping("listUI")
	public String listUI(Model model) throws Exception {
		return Common.BACKGROUND_PATH + "/system/userlogin/list";
	}

	@ResponseBody
	@RequestMapping("findByPage")
	public Page findByPage(String pageNow, String pageSize,String accountName) throws Exception {
		Page page = new Page();
        if (Tools.notEmpty( pageNow))
        {
            page.setCurrentPage(Integer.parseInt(pageNow));
        }
        if (Tools.notEmpty(pageSize))
        {
            page.setShowCount(Integer.parseInt(pageSize));
        }
        else
        {
            page.setShowCount(20);
        }
        LyUserlogin userlogin = new LyUserlogin();
        if (Tools.notEmpty(accountName))
        {
        	userlogin.setAccountName(accountName);
        }
        userlogin.setPage(page);
        page.setRecords(userLoginService.queryByPage(userlogin));
		return page;
	}

}